import cv2
path = r"F:/SY_data_set/龙泉矿/探放水摄像头/1 (10).mp4"
cap = cv2.VideoCapture(path)
frame_counter = 0
print("111")
while (cap.isOpened()):
   ret, frame = cap.read()

   frame_counter += 1
   if frame_counter == int(cap.get(cv2.CAP_PROP_FRAME_COUNT)):
      frame_counter = 0
      cap.set(cv2.CAP_PROP_POS_FRAMES, 0)
#    if not ret:
#       cap.set(cv2.CAP_PROP_POS_FRAMES, 0)
   frame = cv2.resize(frame,(800,600))
   cv2.imshow("frame", frame)
   key = cv2.waitKey(1)
   # ESC
   if key == 27 :
      break
cap.release()
cv2.destroyAllWindows()
